import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter);

const routes = [
    {
        path: '/wx',
        name: 'wx',
        component: () => import('../wx.vue'),
        meta: {name: '微信验证'}
    },
    {
        path: '/',
        name: 'app',
        redirect: '/home',
        component: () => import('../views/layout.vue'),
        children: [
            {
                path: '/tabbar',
                name: 'index',
                component: () => import('../views/tabbar.vue'),
                redirect: '/home',
                children: [
                    {
                        path: '/home',
                        name: 'home',
                        meta: {
                            name: '首页'
                        },
                        component: () => import('../views/main/index.vue')
                    },
                    // {
                    //     path: '/my',
                    //     name: 'mine',
                    //     meta: {
                    //         name: '我的'
                    //     },
                    //     component: () => import('../views/my/index.vue')
                    // }
                ]
            },
            {
                path: '/personal',
                name: 'personal',
                component: () => import('../entry.vue'),
                children: [
                    {
                        path: 'information',
                        name: 'information',
                        meta: {
                            name: '个人信息',
                            auth: true
                        },
                        component: () => import('../views/my/information/index.vue'),
                    }
                ]
            },
            {
                path: '/productDetail/:id',
                name: 'productDetail',
                meta: {name: '产品详情'},
                component: () => import('../views/main/detail.vue')
            },
            {
                path: '/apply/:id',
                name: 'apply',
                meta: {
                    name: '完善企业信息',
                    auth: true
                },
                component: () => import('../views/main/apply.vue')
            },
            {
                path: '/product/:filter',
                name: 'product',
                meta: {
                    name: '产品列表',
                    keepAlive: false
                },
                component: () => import('../views/main/product.vue')
            },
            {
                path: '/notice',
                name: 'notice',
                meta: {
                    name: '公告列表',
                    keepAlive: true
                },
                component: () => import('../views/notice/index.vue')
            },
            {
                path: '/notice/detail/:id',
                name: 'noticeDetail',
                meta: {
                    name: '公告详情'
                },
                component: () => import('../views/notice/detail.vue')
            },
            {
                path: '/about',
                name: 'about',
                meta: {
                    name: '公司介绍'
                },
                component: () => import('../views/my/about.vue')
            },
            {
                path: '/customerService',
                name: 'customerService',
                meta: {
                    name: '联系客服'
                },
                component: () => import('../views/my/customerService.vue')
            },
            {
                path: '/loan',
                name: 'loan',
                meta: {
                    name: '我的贷款',
                    auth: true
                },
                component: () => import('../views/my/loan.vue')
            },
            {
                path: '/agent',
                name: 'agent',
                meta: {
                    name: '申请代理说明',
                    auth: true
                },
                component: () => import('../views/my/agent.vue')
            },
            {
                path: '/agent/apply',
                name: 'applyAgent',
                meta: {
                    name: '申请代理',
                    auth: true
                },
                component: () => import('../views/my/applyAgent.vue')
            },
            {
                path: '/validate',
                name: 'validate',
                meta: {
                    name: '验证手机',
                    auth: true
                },
                component: () => import('../views/my/information/validateTel.vue')
            },
            {
                path: '/changeTel',
                name: 'changeTel',
                meta: {name: '修改手机',auth: true},
                component: () => import('../views/my/information/changeTel.vue')
            },
        ]
    }
];


export default new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
});


